Skip to content

K8SPG-1019 Apply Go 1.26 code improvements using go fix#1585

Merged
hors merged 9 commits into
mainfrom
K8SPG-1019-gofix
May 11, 2026
Merged

K8SPG-1019 Apply Go 1.26 code improvements using go fix#1585
hors merged 9 commits into
mainfrom
K8SPG-1019-gofix

Conversation

@gkech

@gkech gkech commented May 5, 2026

Copy link
Copy Markdown
Contributor

https://perconadev.atlassian.net/browse/K8SPG-1019

CHANGE DESCRIPTION

Problem:

Go 1.26 revamped go fix with 22 new analyzers that automatically modernize code to use current Go idioms. We should run these across the codebase and apply the suggested changes.

Similar PR: percona/percona-xtradb-cluster-operator#2460

Cause:
Short explanation of the root cause of the issue if applicable.

Solution:
Short explanation of the solution we are providing with this PR.

CHECKLIST

Jira

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are all needed new/changed options added to the Helm Chart?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported PG version?
  • Does the change support oldest and newest supported Kubernetes version?


"github.com/percona/percona-postgresql-operator/v2/internal/controller/runtime"
"github.com/percona/percona-postgresql-operator/v2/internal/initialize"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[goimports-reviser] reported by reviewdog 🐶

Suggested change


"github.com/percona/percona-postgresql-operator/v2/internal/feature"
"github.com/percona/percona-postgresql-operator/v2/internal/initialize"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[goimports-reviser] reported by reviewdog 🐶

Suggested change

"github.com/percona/percona-postgresql-operator/v2/internal/config"
"github.com/percona/percona-postgresql-operator/v2/internal/feature"
"github.com/percona/percona-postgresql-operator/v2/internal/initialize"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[goimports-reviser] reported by reviewdog 🐶

Suggested change

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[goimports-reviser] reported by reviewdog 🐶

volumesnapshotv1 "github.com/kubernetes-csi/external-snapshotter/client/v8/apis/volumesnapshot/v1"

@gkech gkech marked this pull request as ready for review May 6, 2026 09:02
Comment thread internal/initialize/primitives.go Outdated

// Bool returns a pointer to v.
func Bool(v bool) *bool { return &v }
//

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this package? I saw that almost all usage of initialize was replaced with new

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still use the package for other functions here and there, better not to do anything with it under this pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed some functions from the package that are not used and fixed some unit tests that, after the go fix didn't do anything meaningful.

mayankshah1607
mayankshah1607 previously approved these changes May 6, 2026
@gkech gkech requested a review from mayankshah1607 May 7, 2026 08:28
hors
hors previously approved these changes May 7, 2026
pooknull
pooknull previously approved these changes May 7, 2026
@gkech gkech dismissed stale reviews from pooknull and hors via ff326cf May 7, 2026 18:05
@gkech gkech force-pushed the K8SPG-1019-gofix branch from ff326cf to da816b2 Compare May 7, 2026 18:07
@gkech gkech requested a review from hors May 7, 2026 18:07
@gkech gkech requested a review from pooknull May 7, 2026 18:07
@JNKPercona

Copy link
Copy Markdown
Collaborator
Test Name Result Time
backup-enable-disable passed 00:00:00
builtin-extensions passed 00:00:00
cert-manager-tls passed 00:00:00
custom-envs passed 00:00:00
custom-extensions passed 00:00:00
custom-tls passed 00:00:00
database-init-sql passed 00:00:00
demand-backup passed 00:00:00
demand-backup-offline-snapshot passed 00:00:00
dynamic-configuration passed 00:00:00
finalizers passed 00:00:00
init-deploy passed 00:00:00
huge-pages passed 00:00:00
major-upgrade-13-to-14 passed 00:00:00
major-upgrade-14-to-15 passed 00:00:00
major-upgrade-15-to-16 passed 00:00:00
major-upgrade-16-to-17 passed 00:00:00
major-upgrade-17-to-18 passed 00:00:00
ldap passed 00:00:00
ldap-tls passed 00:00:00
monitoring passed 00:00:00
monitoring-pmm3 passed 00:00:00
one-pod passed 00:00:00
operator-self-healing passed 00:00:00
pitr passed 00:00:00
scaling passed 00:00:00
scheduled-backup passed 00:00:00
self-healing passed 00:00:00
sidecars passed 00:00:00
standby-pgbackrest passed 00:00:00
standby-streaming passed 00:00:00
start-from-backup passed 00:00:00
tablespaces passed 00:00:00
telemetry-transfer passed 00:00:00
upgrade-consistency passed 00:00:00
upgrade-minor passed 00:00:00
users passed 00:00:00
Summary Value
Tests Run 37/37
Job Duration 00:05:52
Total Test Time N/A

commit: f606450
image: perconalab/percona-postgresql-operator:PR-1585-f60645060

@hors hors merged commit 4a6c022 into main May 11, 2026
11 of 12 checks passed
@hors hors deleted the K8SPG-1019-gofix branch May 11, 2026 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants